//
//  ActionBarItem.swift
//  TheWatermark
//
//  Created by sharui on 2021/6/4.
//

import SwiftUI

struct ActionBarItem: View {
    @Binding var speed: Double
    @State private var isEditing = false
    var title: String
    var range: ClosedRange<Double>
    var body: some View {
        VStack {
            HStack {
                Text(title)
                Spacer()
            }
            Slider(
                value: $speed,
                in: range,
                onEditingChanged: { editing in
                    isEditing = editing
                }
            )
        }.padding()
    }
}


struct ActionBarItemForOpenFile: View {
    @Binding var text: String
    @State private var isEditing = false
    var title: String
    var body: some View {
        VStack {
            HStack {
                Text(title)
                Spacer()
            }
            HStack {
                TextField("输出路径", text: $text)
                    .lineLimit(2)
                Spacer()
                Button("选择路径") {
                    FileManager.selectedFile { path in
                        text = path
                    }
                }
            }
           
        }.padding()
    }
}

struct ActionBarItemForInput: View {
    @Binding var text: String
    @State private var isEditing = false
    var title: String
    var body: some View {
        VStack {
            HStack {
                Text(title)
                Spacer()
            }
            HStack {
                TextField("水印文字", text: $text)
                    .lineLimit(2)
                    
            }
           
        }.padding()
    }
}

